package org.example.types.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 网盘类型枚举
 */
@Getter
@AllArgsConstructor
public enum CloudType {

    BAIDU("baidu", "百度网盘"),
    ALIYUN("aliyun", "阿里云盘"),
    QUARK("quark", "夸克网盘"),
    TIANYI("tianyi", "天翼云盘"),
    UC("uc", "UC网盘"),
    MOBILE("mobile", "移动云盘"),
    ONE_ONE_FIVE("115", "115网盘"),
    PIKPAK("pikpak", "PikPak"),
    XUNLEI("xunlei", "迅雷网盘"),
    ONE_TWO_THREE("123", "123网盘"),
    MAGNET("magnet", "磁力链接"),
    ED2K("ed2k", "电驴链接"),
    OTHERS("others", "其他");

    private final String code;
    private final String name;

    /**
     * 根据代码获取枚举
     */
    public static CloudType fromCode(String code) {
        for (CloudType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return OTHERS;
    }
}